package tcln.sors.client.core.mvc;

import java.awt.Window;

/**
 * Interface for a <b>View</b> component in MVC architecture.
 * 
 * @param <M>
 *            Model class.
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public interface View<M extends ModelData> {

    /**
     * Sets parent view of this view.
     * 
     * @param parent
     */
    void setParentView(View<?> parent);

    /**
     * Returns the display component of this view.
     * 
     * @return
     */
    Window getDisplayComponent();

    /**
     * Sets model for display.
     * 
     * @param model
     */
    void setModel(M model);

    /**
     * Returns current model bound to this view. This model is not necessary to be the same as the one set in
     * {@link #setModel(ModelData)}.
     * 
     * @return
     */
    M getModel();

    /**
     * Shows this view.
     * 
     * @param center
     *            <code>true</code> to force this view to be shown in the center of the owner screen.
     */
    void show(boolean center);

    /**
     * Shows this view in 'modal' mode.
     * 
     * @param center
     *            <code>true</code> to force this view to be shown in the center of the owner screen.
     */
    void showModal(boolean center);

    /**
     * Hide this view.
     */
    void hide();

    /**
     * Unloads this view. This action includes {@link #hide()} method.
     */
    void unload();
}
